package com.markul.android.logic.model.room

import androidx.annotation.NonNull
import androidx.room.*
import androidx.room.util.TableInfo
import com.markul.android.logic.room.User

@Entity
data class PublicRoom(
    val roomName:String,
    val roomPassword:String,
    val roomStyle:String?
){
    @PrimaryKey(autoGenerate = true)
    var pRoomId:Int=0
}

@Entity
data class PublicAlbum(
    var pAlbumOwnerId:Int?,
    var pAlbumText:String?,
    var pLat:Double,
    var pLng:Double,
    var pAlbumTime:String,
    var pAlbumIcon1:Int?,
    var pAlbumIcon2:Int?,
    var pAlbumIcon3:Int?

){
    @PrimaryKey(autoGenerate = true)
    var pAlbumId: Int=0
}

@Entity(primaryKeys = ["userId","pRoomId"],tableName = "UserAndPublicRoomCrossRef")
data class UserAndPublicRoomCrossRef(
    val userId:Int,
    val pRoomId:Int,
    val userHeadImage:Int,
    val roomName:String,
    val roomStyle:String?
)

@Entity
data class PublicPhoto(
    var pPhotoUrl:String,
    var pPhotoOwnerId: Int,
    var pPhotoUploaderId:Int,
){
    @PrimaryKey(autoGenerate = true)
    var pPhotoId: Int = 0
}

data class PublicRoomWithPublicAlbums(
    @Embedded val pRoom:PublicRoom,
    @Relation(
        parentColumn = "pRoomId",
        entityColumn = "pAlbumOwnerId",
    )
    val pAlbumList:List<PublicAlbum>
)

data class PublicAlbumWithPublicPhotos(
    @Embedded val pAlbum:PublicAlbum,
    @Relation(
        parentColumn = "pAlbumId",
        entityColumn = "pPhotoOwnerId",
    )
    val pPhotoList:List<PublicPhoto>
)